package com.mzj.saas.mservice.enterprise.controller;


import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.enterprise.service.EnterpriseDataService;
import com.mzj.saas.mservice.enterprise.vo.RequestParamVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/enterprise/data")
public class EnterpriseDataController {

    @Autowired
    private EnterpriseDataService enterpriseDataService;


    /**
     * 员工数据
     *
     * @param accessToken
     * @return
     */
    @GetMapping("/employeeData")
    @ResponseBody
    public ResultBean<Map<String, Integer>> employeeData(@RequestHeader String accessToken) {
        return enterpriseDataService.employeeData(accessToken);
    }

    /**
     * 企业每日数据
     *
     * @param accessToken
     * @return
     */
    @GetMapping("enterpriseDailyData")
    @ResponseBody
    public ResultBean<List<Map<String, Integer>>> enterpriseDailyData(@RequestHeader String accessToken) {
        return enterpriseDataService.enterpriseDailyData(accessToken);
    }

    /*
     *查看离职/未激活员工 0未激活 1激活 2已离职
     */
    @PostMapping("leaveDepartmentPeople")
    @ResponseBody
    public ResultBean<Object> leaveDepartmentPeople(@RequestHeader String accessToken, @RequestParam(name = "status", required = false) Integer status, @RequestParam(defaultValue = "0") Integer pageNumber,
                                                    @RequestParam(defaultValue = "10") Integer pageSize) {
        return enterpriseDataService.leaveDepartmentPeople(accessToken, status, pageNumber, pageSize);
    }

    /*
     * 管理员操作记录
     */
    @PostMapping("managerOperationRecord")
    @ResponseBody
    public ResultBean<Object> managerOperationRecord(@RequestHeader String accessToken, @RequestParam(defaultValue = "0") Integer pageNumber,
                                                     @RequestParam(defaultValue = "10") Integer pageSize, RequestParamVO filter) {
        return enterpriseDataService.managerOperationRecord(accessToken, pageNumber, pageSize, filter);
    }
}
